<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="me.yobol.greentable.commons.path.*" %>
<%@ page import="me.yobol.greentable.bean.IngredientBean" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>Ingredient List</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

  </head>
  
	<body>
	<%
		List<IngredientBean> ingredients = (List<IngredientBean>)(request.getSession().getAttribute("ingredient_list"));
		int flag = (request.getParameter("flag") == null) ? -1
				: Integer.parseInt(request.getParameter("flag"));
		int traderId = (request.getSession().getAttribute("uId") == null) ? -1
				: (Integer)request.getSession().getAttribute("uId");
	%>
		菜品：<br/>
	<%
		if(!ingredients.isEmpty()){
			for(IngredientBean ig : ingredients){
	%>
				<a href="<%=SPath.sGetIngredient(request,"?ingredientId=" + ig.getIngredientId()) %>">
					<%=ig.getIngredientName() %> : <%=ig.getIngredientDescription() %> : <%=ig.getIngredientPrice() %>￥
				</a>
				<%
					if(flag == 1 && traderId == ig.getTraderId()){
				%>
					&nbsp;&nbsp;<a href="<%=PPath.pModifyIngredient(request,"?igId=" + ig.getIngredientId()) %>">修改</a>
					&nbsp;&nbsp;<a href="<%=SPath.sDeleteIngredient(request,"?igId=" + ig.getIngredientId()) %>">删除</a>
				<%
					}
				%>
				<br/>
	<%
			}
		}
	%>
  </body>
</html>
